package vista;

import java.util.ArrayList;

import modelo.Lote;

import javax.swing.table.AbstractTableModel;

public class VentanaTablaDeposito extends AbstractTableModel{
	private static String[] titulos = {"Descripcion","Nro de Contenedor", "Contenedor","Existencia"};
	private ArrayList<Lote> lotes;

	public VentanaTablaDeposito(ArrayList<Lote> lotes) {
		super();
		this.lotes = lotes;
	}
	
	public void eliminarDetallePedido(int rowIndex) {
	this.lotes.remove(rowIndex);

	}
	@Override
	public int getColumnCount() {
		// TODO Auto-generated method stub
		return titulos.length;
	}

	@Override
	public int getRowCount() {
		// TODO Auto-generated method stub
		return lotes.size();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Lote lote = lotes.get(rowIndex);
		switch (columnIndex){
			case 0: return lote.getDescripcion();
			case 1: return lote.getNumContenedor();	
			case 2: return lote.getContenedor();
			case 3: return lote.getCantLote();
		}
		return null;
	}

	@Override
	public String getColumnName(int column) {
		return titulos[column];
	}

}

